﻿/* Muaz Khan – http://dashingquill.web.officelive.com */
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using DTweet.Models;

namespace DTweet.Helpers
{
    /***********************************
    * At user's homepage, this class has been used to display number of followers, following and total tweets --- UserPage.cshtml
    ***********************************/
    public class UserInfo
    {
        public int Following { get; set; }
        public int Followers { get; set; }
        public int PostsCount { get; set; }
        public int PrivatePostsCount { get; set; }

        public UserInfo(DatabaseEntities db, string userToken)
        {            
            PostsCount = db.Tweets.Where(t => t.UserToken == userToken && t.SharedTo == "Public").Count();
            PrivatePostsCount = db.Tweets.Where(t => t.UserToken == userToken && t.SharedTo != "Public").Count();

            Followers = 0;
            Following = 0;
        }
    }
}